#ifndef HTTPREQUEST_H
#define HTTPREQUEST_H

#include<QThread>
#include <QDebug>
#include <QTextCodec>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QEventLoop>
#include <QRegularExpression>
#include <QString>
#include <QCoreApplication>





#include "winsock2.h"

const QString QUERY_IP = "220.181.38.251";

class httpRequest :public QThread
{
    Q_OBJECT
private:
    QString request;
    SOCKET sock;
    const char *ip_addr;
    char result[30];
    int buffer_size;
    QString position;

protected:
    void run() override;
signals:
    void httpSend(QString position);

public:
    httpRequest();

    bool GetIp(QString name);
    bool ConnectHttpServer();
    bool GetPosition();
    bool SetSockInfo();

    QString GetResult();
    void SetIpAddr(QString ip_addr);

    QString queryIpLocation(const QString& ipAddress);
};

#endif // HTTPREQUEST_H
